package com.iflytek.edu.db.core.strategy.dm.function;

import com.alibaba.druid.sql.ast.SQLObject;
import com.iflytek.edu.db.core.constant.FunctionConstant;
import com.iflytek.edu.db.core.context.AdapterContext;
import com.iflytek.edu.db.core.strategy.FunctionStrategy;

/**
 * @author linkai
 * @date 2022/1/12
 */
public class DmScopeIdentityFuncStrategy implements FunctionStrategy {

    @Override
    public boolean support(SQLObject obj) {
        return checkName(obj, FunctionConstant.MYSQL.LAST_INSERT_ID);
    }

    @Override
    public void convert(SQLObject obj) {
        convertName(obj, FunctionConstant.DM.SCOPE_IDENTITY);
    }

    @Override
    public void search(SQLObject obj) {
        AdapterContext.addProblem(strategyType(), "方法不支持：" + getMethodName(obj));
    }
}
